ag3<-ag[ag$state!="NJ",]

states<-unique(ag3$state)
coef<-NA
se<-NA
lb<-NA
ub<-NA
sig<-NA

for(i in 1:length(states)){
	m<-lm(yes~ factor(treat) + factor(match_id), data=ag3[ag3$state!=states[i],])
	summary(m)
	
	coef[i]<-m$coefficients[2]
	m2<-coeftest(m, vcov=vcovHC(m))
	se[i]<-m2["factor(treat)2","Std. Error"]
	lb[i]<-coef[i]-1.96*se[i]
	ub[i]<-coef[i]+1.96*se[i]
	sig[i]<-I(lb[i]*ub[i]>0)
	
}

res<-cbind.data.frame(state=states, coef=coef, se=se, lb=lb, ub=ub,sig=sig)

res$coef <- res$coef*100

(state_drop <- ggplot(res,aes(x=coef))+ 
		geom_histogram() +
		theme_bw()+
		xlim(-9,-7)+
		xlab("Estimated Coefficient")+
		ylab("Count") + 
		geom_hline(yintercept=0, linetype="dotted") + 
		theme(panel.spacing = unit(1, "lines")) + 
		theme(panel.grid.major = element_line(colour = "white"),panel.grid.minor = element_line(colour = "white"), axis.title.x = element_text(vjust=-0.5)) +
		
		ggtitle("Response to collaboration discussion requests:\nSensitivity to Dropping Single States"))

ggsave(plot=state_drop,"results/state_drop.pdf",width=6, height=6)